import { axiosInstance } from "..";

//表單保存，formHeader:表單標頭信息,formDetail:表單明細信息
function GetTask(param: string) {
  return new Promise((resolve, reject) => {
    axiosInstance()
      .post("/improveAchievement/home/getTask", { param })
      .then(
        (res: any) => {
          resolve(res);
        },
        (err: any) => {
          reject(err);
        }
      );
  });
}

function GetMangerInfo(docid: string, username: string) {
  return new Promise((resolve, reject) => {
    axiosInstance()
      .post("/improveAchievement/home/managerinfo", { docid, username })
      .then(
        (res: any) => {
          resolve(res);
        },
        (err: any) => {
          reject(err);
        }
      );
  });
}

function SendApprove(
  docid: string,
  approve: string,
  comments: string,
  username: string
) {
  return new Promise((resolve, reject) => {
    axiosInstance()
      .post("/improveAchievement/home/sendapprove", {
        docid,
        approve,
        comments,
        username,
      })
      .then(
        (res: any) => {
          resolve(res);
        },
        (err: any) => {
          reject(err);
        }
      );
  });
}


export { GetTask, GetMangerInfo, SendApprove };
